import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
public class Theater {
    String name;
    int rows;
    int cols;
    boolean[][] seats; // true=已售，false=可选

    Theater(String name, int rows, int cols) {
        this.name = name;
        this.rows = rows;
        this.cols = cols;
        this.seats = new boolean[rows][cols];
    }

    public int totalSeats() { return rows * cols; }
    public int availableSeats() {
        int cnt = 0;
        for (boolean[] r : seats)
            for (boolean s : r)
                if (!s) cnt++;
        return cnt;
    }

    // 试着预定座位
    public List<String> reserveSeats(int r, int c, int count) {
        List<String> seatsList = new ArrayList<>();
        int booked = 0;
        for (int i = r; i < rows && booked < count; i++) {
            for (int j = c; j < cols && booked < count; j++) {
                if (!seats[i][j]) {
                    seats[i][j] = true;
                    seatsList.add((i+1) + "-" + (j+1));
                    booked++;
                }
            }
        }
        return seatsList;
    }

    public void resetAll() {
        for (boolean[] row : seats)
            Arrays.fill(row, false);
    }
}
